home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
8bit
/
cislib_a
/
macros.doc
< prev
next >
Wrap
Text File
|
1995-04-22
|
19KB
|
925 lines
Macro library usage definitions
Page 1
MACRO usages
*=*=*=*=*=*=*=*=*=*=*=*=*
* Data placement *
*=*=*=*=*=*=*=*=*=*=*=*=*
MEM
Developmental ORG
[When developing programs that will run in 16K, it is advantageous to
locate them above DOS (typically $4000 to $7FFF) although they will
ultimately run at around $600 or so. This makes it easier to load
modules to be written to boot disks etc. without using a separate
utility.]
During development, set OFFSET = $4000 and DEVELOP = OFFSET. This will
put code in high memory and execute it there. On the final assembly,
set DEVELOP = 0. This will assemble code as though it would run in low
memory, but write the binary file to load the program image to high
memory.
Usage:
MEM address
Example:
MEM $800
yields:
given:(DEVELOP = $4000)
(OFFSET = 0)
ORG $4800
LOC $800
USEBEG
My "USE"
[The AMAC USE command simply doesn't work. This crude kludge saves the
current LOC and ORG counters to allow temporary re-placement of inline
code. This uses the MEM macro to update ORG and LOC according to
developmental variables. Also uses local labels, so USEBEG and USEEND
must both reside in the same PROC module, and cannot be nested.]
Usage:
USEBEG address
Example:
USEBEG $3000
yields:
Macro library usage definitions
Page 2
:otmp SET *O
:ltmp SET *L
MEM $3000
USEEND
Recovery from USEBEG
Restores ORG and LOC counters after temporary resetting via USEBEG.
Usage:
USEEND (no operand)
Produces:
ORG :otmp
LOC :ltmp
*=*=*=*=*=*=*=*=*=*=*=*=*
* 8-bit arithmetic *
*=*=*=*=*=*=*=*=*=*=*=*=*
ADD
Add WITHOUT carry
Usage:
ADD #constant
ADD address
ADD address,X
ADD address,Y
Example:
ADD TROGS,Y
yields:
CLC
ADC TROGS,Y
SUB
Subtract WITHOUT carry
Usage:
SUB #constant
SUB address
SUB address,X
SUB address,Y
Example:
SUB #$30
yields:
SEC
Macro library usage definitions
Page 3
SBC #$30
DIV
Divide A by a power of 2
Usage: DIV power of 2
Example:
DIV 8
yields:
LSR A
LSR A
LSR A
MUL
Multiply A by a power of 2
Usage: MUL power of 2
Example:
MUL 16
yields:
ASL A
ASL A
ASL A
ASL A
BMP
Add constant to byte at address
Usage: BMP address,constant
BMP address,X,constant
BMP address,Y,constant
Example:
BMP BORT,125
yields:
LDA BORT
CLC
ADC #125
STA BORT
BAK
Subtract constant from byte at address
Usage: BAK address,constant
BAK address,X,constant
BAK address,Y,constant
Macro library usage definitions
Page 4
Example:
BAK GLERX,Y,$42
yields:
LDA GLERX,Y
SEC
SBC #$42
STA GLERX,Y
*=*=*=*=*=*=*=*=*=*=*=*=*
* 16-bit arithmetic *
*=*=*=*=*=*=*=*=*=*=*=*=*
ADW
Add two words at addresses and store at a third
Usage: ADW address 1,address 2,dest. address
Example:
ADW WREG,TEDUK,WREG
yields:
LDA WREG
CLC
ADC TEDUK
STA WREG
LDA WREG+1
ADC TEDUK+1
STA WREG+1
SBW
Subtract two words at addresses and store at a third
Usage: SBW address 1,address 2,dest. address
Example:
SBW VEP,QWERTY,GADS
yields:
LDA VEP
SEC
SBC QWERTY
STA GADS
LDA VEP+1
SBC QWERTY+1
STA GADS+1
BMPW
Add a constant to a word at address
Usage: BMPW address,constant
Macro library usage definitions
Page 5
Example:
BMPW KLUT,$4258
yields:
LDA KLUT
CLC
ADC #$58
STA KLUT
LDA KLUT+1
ADC #$42
STA KLUT+1
BAKW
Subtract a constant from a word at address
Usage: BAKW address,constant
Example:
BAKW NATHIL,HPOS
yields:
LDA NATHIL
SEC
SBC #LOW HPOS
STA NATHIL
LDA NATHIL+1
SBC #HIGH HPOS
STA NATHIL+1
INW
Increment a word at address
Usage: INW address
Example:
INW GOLD
yields:
INC GOLD
BNE LABEL
INC GOLD+1
LABEL = *
DEW
Decrement a word at address
Usage: DEW address
Example:
DEW ZUGG
yields:
Macro library usage definitions
Page 6
LDA ZUGG
BNE LABEL
DEC ZUGG+1
LABEL DEC ZUGG
*=*=*=*=*=*=*=*=*=*=*=*=*=*
* Conditional branches *
*=*=*=*=*=*=*=*=*=*=*=*=*=*
Usage for all branch instructions:
XXX address
BGE
Branch on Greater than or Equal to
BGT
Branch on Greater than
BLE
Branch on Less than or Equal to
BLT
Branch on Less than
BNZ
Branch on Non Zero
BZ
Branch on Zero
*=*=*=*=*=*=*=*=*=*=*=*=*
* Conditional jumps *
*=*=*=*=*=*=*=*=*=*=*=*=*
Usage for all jump instructions:
XXX address
JMI
Jump on Minus
JPL
Jump on Plus
JCS
Jump on Carry Set
JCC
Jump on Carry Clear
Macro library usage definitions
Page 7
JGE
Jump on Greater than or Equal to
JGT
Jump on Greater than
JLE
Jump on Less than or Equal to
JLT
Jump on Less than
JNE
Jump on Not Equal
JNZ
Jump on Non Zero
JEQ
Jump on Equal to